<!-- 上课周期设置  -->
<template>
    <div class=""  >
        <div class="container" v-loading="dataListLoading">
            <div class="stu-header">
                <el-form :inline="true" :model="formInline" ref="formInline" class="demo-form-inline">
                    <el-form-item  class="nine-form-title" prop="yearly" label="学年">
                        <el-select placeholder="请选择"  v-model="formInline.yearly" clearable>
                            <el-option  v-for="(item, index) in list1" :key="index" :label="item.yearValue" :value="item.yearKey"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item class="nine-form-title" prop="areaId" label="上课校区" style="margin-left: 10px">
                        <el-select v-model="formInline.areaId" placeholder="请选择" clearable>
                            <el-option  v-for="(item, index) in list2" :key="index" :label="item.areaName" :value="item.areaId"></el-option>
                        </el-select>
                    </el-form-item> 
                   
                </el-form>
            </div>
            <div class="handle-box">
                <el-button type="primary" @click="add()">新增</el-button>
                <el-button @click="submitForm(formInline)">查询</el-button> 
            </div>
            <el-table  :data="tableData"  border highlight-current-row  class="table"  ref="multipleTable"  :header-cell-style="{background: '#f1f1f1', color: '#333'}" 
                >
               <!--  <el-table-column label="序号" header-align="center" align="center" width="50">
                    <template slot-scope="scope"><span>{{scope.$index+(pageIndex- 1) * pageSize + 1}} </span></template>
                </el-table-column> -->
                <el-table-column show-overflow-tooltip prop="name" header-align="center" align="left" label="上课周期名称" ></el-table-column>
                <el-table-column prop="areaName" header-align="center" align="center" label="上课学区" ></el-table-column>
                <el-table-column prop="yearly" header-align="center" align="center" label="学年" ></el-table-column>
                <el-table-column prop="productId" header-align="center" align="center" label="三级产品线" ></el-table-column>
                <el-table-column prop="cycle" header-align="center" align="center" label="上课周期" ></el-table-column>
                <el-table-column prop="weakNum" header-align="center" align="center" label="周次数" ></el-table-column>
                 <el-table-column label="操作" min-width="180" header-align="center" align="center">
                    <template slot-scope="scope">
                        <el-button type="text" icon="el-icon-edit" @click="checkData(scope.$index, scope.row,1)">编辑</el-button>
                        <el-button type="text" icon="el-icon-date" @click="handleLook(scope.$index, scope.row)">日历</el-button>
                        <el-button type="text" icon="el-icon-delete" class="red" @click="checkData(scope.$index, scope.row,2)">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination">
                <el-pagination
                    @size-change="sizeChangeHandle"
                    @current-change="currentChangeHandle"
                    :current-page="pageIndex"
                    :page-sizes="[10,20, 50]"
                    :page-size="pageSize"
                    :total="totalPage"
                    layout="total, sizes,prev, pager, next, jumper">
                </el-pagination>
            </div>
        </div>

        <!-- 新增弹出框 -->
        <el-dialog title="上课周期设置" v-dialogDrag v-if="addVisible" :visible.sync="addVisible" width="40%" class="zl-dialog" :close-on-click-modal="false" @close="resetForm('addform','addVisible')">
            <div class="el-dialog-div">
                <el-form ref="addform" :model="form" label-width="110px" :rules="rules" >
                    <el-form-item label="上课周期名称"  prop="cycleName">
                        <el-input v-model="form.cycleName" class="small smart covered" clearable></el-input>
                    </el-form-item>
                    <el-form-item  prop="yearlyAdd" label="学年"  >
                        <el-select placeholder="请选择"  v-model="form.yearlyAdd" clearable>
                            <el-option  v-for="(item, index) in list1" :key="index" :label="item.yearValue" :value="item.yearKey"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item  prop="productId3Add" label="三级产品线">
                        <el-select placeholder="请选择"  v-model="form.productId3Add" clearable>
                            <el-option  v-for="(item, index) in list3" :key="index" :label="item.name" :value="item.id"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item  prop="areaIdAdd" label="上课校区">
                        <el-select v-model="form.areaIdAdd" placeholder="请选择" clearable>
                            <el-option  v-for="(item, index) in list2" :key="index" :label="item.areaName" :value="item.areaId"></el-option>
                        </el-select>
                        </el-form-item>
                    <el-form-item label="开课日期"  prop="beginDate">
                        <el-col :span="13">
                            <el-date-picker type="date" clearable :picker-options="startDatePicker" placeholder="选择日期" v-model="form.beginDate" style="width: 100%;"></el-date-picker>
                        </el-col>
                    </el-form-item>
                    <el-form-item label="结课日期"  prop="endDate">
                        <el-col :span="13">
                            <el-date-picker type="date" clearable :picker-options="endDatePicker" placeholder="选择日期" v-model="form.endDate" style="width: 100%;"></el-date-picker>
                        </el-col>
                    </el-form-item>
                    <el-form-item label="上课休息周" height="200px" prop="sleepWeek" >
                       <!--  <div>
                            <el-col :span="13">
                                <el-date-picker clearable :picker-options="pickerOptions" type="date" placeholder="选择日期" v-model="form.sleepWeek[0]" style="width: 100%;" ></el-date-picker>
                            </el-col>
                            <el-button class="el-add" type='text' icon="el-icon-circle-plus" @click="plusData()"></el-button>
                        </div> -->
                        <div v-for="(item,index) in form.sleepWeek" :key="index">
                            <el-col :span="13">
                                <el-date-picker clearable  value-format="yyyy-MM-dd" :picker-options="pickerOptions" type="date" placeholder="选择日期" @change="handlerDate(form.sleepWeek[index], index)" v-model="form.sleepWeek[index]" style="width: 100%;"></el-date-picker>
                            </el-col>
                            <el-button v-if="index ==0" class="el-add" type='text' icon="el-icon-circle-plus" @click="plusData()"></el-button>
                            <el-button v-else class="el-remove" type='text' icon="el-icon-remove" @click="removeData(index)"></el-button>
                        </div>
                    </el-form-item>
                </el-form>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="resetDialog('addVisible')">取 消</el-button>
                <el-button type="primary" @click="saveAdd">确 定</el-button>
            </span>
        </el-dialog>
        <!-- 编辑弹出框 -->
        <el-dialog title="上课周期设置" v-dialogDrag v-if="editVisible" :visible.sync="editVisible" width="40%" class="zl-dialog" :close-on-click-modal="false" @close="resetForm('form','editVisible')">
           <el-form ref="form" :model="form" label-width="110px" :rules="rules" class="el-dialog-div">
                <el-form-item label="上课周期名称" prop="cycleName">
                    <el-input v-model="form.cycleName" class="covered smart small" clearable></el-input>
                </el-form-item>
                <el-form-item  prop="yearlyAdd" label="学年">
                        <el-select placeholder="请选择"  v-model="form.yearlyAdd" clearable>
                            <el-option  v-for="(item, index) in list1" :key="index" :label="item.yearValue" :value="item.yearKey"></el-option>
                        </el-select>
                </el-form-item>
                 <el-form-item  prop="productId3Add" label="三级产品线">
                        <el-select placeholder="请选择"  v-model="form.productId3Add" clearable>
                            <el-option  v-for="(item, index) in list3" :key="index" :label="item.name" :value="item.id"></el-option>
                        </el-select>
                </el-form-item>
                 <el-form-item  prop="areaIdAdd" label="上课校区">
                        <el-select v-model="form.areaIdAdd" placeholder="请选择" clearable>
                            <el-option  v-for="(item, index) in list2" :key="index" :label="item.areaName" :value="item.areaId"></el-option>
                        </el-select>
                    </el-form-item>
                <el-form-item label="开课日期" prop="beginDate">
                    <el-col :span="13">
                        <el-date-picker type="date" clearable :picker-options="startDatePicker" placeholder="选择日期" v-model="form.beginDate" style="width: 100%;"></el-date-picker>
                    </el-col>
                </el-form-item>
                <el-form-item label="结课日期" prop="endDate">
                    <el-col :span="13">
                        <el-date-picker type="date" clearable :picker-options="endDatePicker" placeholder="选择日期" v-model="form.endDate" style="width: 100%;"></el-date-picker>
                    </el-col>
                </el-form-item>
                <el-form-item label="上课休息周" height="200px" prop="sleepWeek" >
                       <!--  <div>
                            <el-col :span="13">
                                <el-date-picker clearable :picker-options="pickerOptions" type="date" placeholder="选择日期" v-model="form.sleepWeek" style="width: 100%;" ></el-date-picker>
                            </el-col>
                            <el-button class="el-add" type='text' icon="el-icon-circle-plus" @click="plusData()"></el-button>
                        </div>
                        <div v-for="(item,index) in items" :key="index">
                            <el-col :span="13">
                                <el-date-picker clearable :picker-options="pickerOptions" type="date" placeholder="选择日期" v-model="item[index]" style="width: 100%;"></el-date-picker>
                            </el-col>
                            <el-button class="el-remove" type='text' icon="el-icon-remove" @click="removeData()"></el-button>
                        </div> -->
                        <div v-for="(item,index) in form.sleepWeek" :key="index">
                            <el-col :span="13">
                                <el-date-picker clearable  value-format="yyyy-MM-dd" @change="handlerDate(form.sleepWeek[index], index)" :picker-options="pickerOptions" type="date" placeholder="选择日期" v-model="form.sleepWeek[index]" style="width: 100%;"></el-date-picker>
                            </el-col>
                            <el-button v-if="index ==0" class="el-add" type='text' icon="el-icon-circle-plus" @click="plusData()"></el-button>
                            <el-button v-else class="el-remove" type='text' icon="el-icon-remove" @click="removeData(index)"></el-button>
                        </div>
                    </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="resetDialog('editVisible')">取 消</el-button>
                <el-button type="primary" @click="saveEdit">确 定</el-button>
            </span>
        </el-dialog>

        <!-- 删除提示框 -->
        <el-dialog title="提示" :visible.sync="delVisible" width="300px" center>
            <div class="del-dialog-cnt">删除不可恢复，是否确定删除？</div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="delVisible = false">取 消</el-button>
                <el-button type="primary" @click="deleteRow">确 定</el-button>
            </span>
        </el-dialog>

        <!-- 日历弹出框 -->
        <el-dialog title="上课周期日历查看" v-dialogDrag v-if="lookVisible" v-model="lookVisible" width="40%">
            <el-table  :data="calendarData"  border highlight-current-row  class="table dialog-table"  ref="multipleTable"  :header-cell-style="{background: '#f1f1f1', color: '#333'}"  >
                <el-table-column prop="weekNum2" header-align="center" align="center" label="周数" width='120' >
                </el-table-column>
                <el-table-column prop="dateCycle2" header-align="center" align="center" label="日期" >
                </el-table-column>
            </el-table>
            <span slot="footer" class="dialog-footer">
                <el-button @click="lookVisible = false">关闭</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script setup lang="ts">
import {crmUrl} from '@/utils/api'; 
import saveFlag from '@/mixin/saveFlag'; 
import  { dateToString,dateToString2,formatDate}  from '@/utils/helper';  
import {mapGetters, mapMutations, mapActions} from 'vuex'
import { ref } from 'vue';
let formInline = ref({});
formInline.value={
    yearly: '',
    areaId: '',
}
let lookVisible = ref(false);
    // export default {
    //     name: '',
    //     mixins: [saveFlag],
    //     data() {
    //         return {
    //             rules: {
    //                 cycleName: [
    //                     { required: true, message: '上课周期必填', trigger: 'blur' },
    //                 ],
    //                 yearlyAdd: [
    //                     { required: true, message: '学年必选', trigger: 'change' }
    //                 ],
    //                 productId3Add: [
    //                     {  required: true, message: '三级产品线必选', trigger: 'change' }
    //                 ],
    //                 areaIdAdd: [
    //                     {  required: true, message: '上课校区必选', trigger: 'change' }
    //                 ],
    //                 beginDate: [
    //                     { type: 'date', required: true, message: '开课日期必填', trigger: 'change' }
    //                 ],
    //                 endDate: [
    //                     { type: 'date',required: true, message: '结课日期必填', trigger: 'change' }
    //                 ]
    //             },               
    //             dataListLoading: false,
    //             formInline: {
    //                 yearly: '',
    //                 areaId: '',
    //             },
    //             url: './vuetable.json',
    //             pageIndex: 1,
    //             pageSize: 10,
    //             totalPage: 0,
    //             tableData: [],
    //             calendarData:[],
    //             addVisible : false,
    //             editVisible: false,
    //             delVisible: false,
    //             lookVisible: false,
    //             form: {
    //                 id:'',
    //                 cycleName: '',
    //                 yearlyAdd: '',
    //                 productId3Add: '',
    //                 areaIdAdd: '',
    //                 beginDate: '',
    //                 endDate: '',
    //                 sleepWeek: [''],
    //                 sleepWeek2:[],
    //                 dateTests:''
    //             },
    //             list1:[],
    //             list2:[],
    //             list3:[],
    //             cycleId:'',
    //             items : [],
    //             text : 0,
    //             dateBasic:new Date(),
    //             code:'',
    //             // saveStatus:false,
    //             startDatePicker: {
    //                 disabledDate: (time) => {
    //                     var day = new Date(time).getDay()
    //                     if(day==1){
    //                         return false;
    //                     } else {
    //                         return true;
    //                     }
    //                     if (this.form.endDate != "") {
    //                         return time.getTime() > new Date(this.form.endDate).getTime();
    //                     }
    //                     /*  范围是否大于今天
    //                     else{
    //                         return time.getTime() > Date.now();
    //                     } */

    //                 }
    //             },
    //             endDatePicker: {
    //                 disabledDate: (time) => {
    //                     if(this.form.beginDate !=""){
    //                         return time.getTime() < new Date(this.form.beginDate).getTime();
    //                     }
                        
    //                 }
    //             },
    //           /*   pickerOptions: {
    //                 disabledDate:(time)=> {
    //                     let _this = this;
    //                     var day = new Date(time).getDay()
    //                     if(this.form.beginDate && this.form.endDate){//开课日期，结课日期都有值
    //                         if(day==1 && time.getTime() < new Date(this.form.endDate).getTime() 
    //                             && time.getTime() > new Date(this.form.beginDate).getTime()){//只能选择周一，开课日期和结课日期之间范围
    //                             // if(this.form.sleepWeek && this.form.sleepWeek.length>0){//
    //                             //     for(var i =0; i< _this.form.sleepWeek.length; i++){
    //                             //         let item = _this.form.sleepWeek[i];
    //                             //         if(item){//禁用已经选择了休息周
    //                             //             let newD = item.replace(/-/,'/');
    //                             //             return time.getTime() == new Date(newD).getTime()
    //                             //         }else{
    //                             //             return false;
    //                             //         }
    //                             //     }
    //                             // }else{
    //                                 return false;
    //                             // }
    //                         }else{
    //                             return true;
    //                         }                             
    //                     }else{//没有值全部禁用
    //                         return true;
    //                     }
    //                 }
    //             },   */
    //         }
    //     },
    //     beforeRouteLeave (to, from, next) {        
    //         to.meta.isUseCache = false;
    //         next();    
    //     },
    //     computed: {
    //         pickerOptions() {
    //             const _self = this;
    //             return {
    //                 disabledDate: (time) => {
    //                     let _this = this;
    //                     var day = new Date(time).getDay()
    //                     if(this.form.beginDate && this.form.endDate){//开课日期，结课日期都有值
    //                         if(day==1 && time.getTime() < new Date(this.form.endDate).getTime() 
    //                             && time.getTime() > new Date(this.form.beginDate).getTime()){//只能选择周一，开课日期和结课日期之间范围
    //                             if(this.form.sleepWeek && this.form.sleepWeek.length>0){//
    //                                 /* for(var i =0; i< _this.form.sleepWeek.length; i++){
    //                                     let item = _this.form.sleepWeek[i];
    //                                     if(item){//禁用已经选择了休息周
    //                                         let newD = item.replace(/-/,'/');
    //                                         return time.getTime() == new Date(newD).getTime()
    //                                     }else{
    //                                         return false;
    //                                     }
    //                                 } */
    //                             }else{
    //                                 return false;
    //                             }
    //                         }else{
    //                             return true;
    //                         }                             
    //                     }else{//没有值全部禁用
    //                         return true;
    //                     }
    //                 },
    //             }
    //         },
    //     },
    //     created() {
    //         // this.formInline.yearly = '2018';
    //         // this.code = this.$route.query.code ;
    //         this.getSessionSearch();
    //         this.getYears();
            
    //     },
       
    //     methods: {
    //         ...mapMutations('schoolcoursecycle',['setSearchParams','setShowOtherParam','setRouteParams']),
    //         getSessionSearch(){
    //             if(JSON.stringify(this.$route.params)!='{}'){
    //                 this.formInline = this.$route.params;
    //             }  
    //         },
    //         resetDialog(name){
    //             this.form={
    //                 id:'',
    //                 cycleName: '',
    //                 yearlyAdd: '',
    //                 productId3Add: '',
    //                 areaIdAdd: '',
    //                 beginDate: '',
    //                 endDate: '',
    //                 sleepWeek: [''],
    //                 sleepWeek2:[],
    //                 dateTests:''
    //             }
    //             this[name] = false;
    //         },
    //         handlerDate(val, index){
    //             if(!val){
    //                 this.form.sleepWeek[index] = '';
    //             }
    //         },
    //         // 每页数
    //         sizeChangeHandle (val) {
    //             this.pageSize = val
    //             this.pageIndex = 1
    //             this.getTableData();
    //         },
    //         // 当前页
    //         currentChangeHandle (val) {
    //             this.pageIndex = val;
    //             this.getTableData(this.pageIndex,this.pageSize);
    //         }, 
    //         getTableData(pageIndex,pageSize){
                
    //             this.dataListLoading = true;
    //             if(!this.formInline.yearly){
    //                 this.formInline.yearly = '';
    //             }
    //             if(!this.formInline.areaId){
    //                 this.formInline.areaId = '';
    //             }
                
    //              this.$axios.post(baseUrl+'/ft/ftteaching/queryQRZCourseCycle.do?'
    //              +'yearly='+this.formInline.yearly+'&areaId='+this.formInline.areaId
    //              +'&page='+this.pageIndex+'&rows='+this.pageSize).then(res => {
    //                 if(res.data!=null && res.data.rows!=null && res.data.rows[0]!=null){
    //                      this.tableData = res.data.rows;
    //                      this.totalPage = res.data.total;
    //                  }else{
    //                     this.tableData = []; 
    //                      this.totalPage = 0;
    //                  }
    //                 this.dataListLoading = false;
    //             }, err => {
    //                 this.$message.error(err);
    //             });
    //         },
    //         getYears(){
    //             //获取学年
    //             this.$axios.get(baseUrl+'/ft/ftchoose/getQrzYears.do?type=1')
    //                 .then(res => {
    //                     //获取菜单列表
    //                     this.list1 = res.data.data.list;
    //                     if(JSON.stringify(JSON.parse(window.sessionStorage.getItem("vuex")).schoolcoursecycle.searchParams)=='{}'){
    //                         this.formInline.yearly = res.data.data.currentYear;
    //                     }
                       
    //                     this.getTableData();
    //             }, err => {
    //                 this.$message.error(err);
    //             });
    //               //获取学区
    //               this.$axios.get(baseUrl+'/ft/ftchoose/getQrzAreas.do')
    //                 .then(res => {
    //                     //获取菜单列表
    //                     this.list2 = res.data;
    //                     // this.totalPage = res.data.totalPage;
    //                     this.dataListLoading = false;
    //             }, err => {
    //                 this.$message.error(err);
    //             });
    //             //获取三级产品线
    //               this.$axios.get(baseUrl+'/ft/ftchoose/getProductId3.do')
    //                 .then(res => {
    //                     //获取菜单列表
    //                     this.list3 = res.data;
    //                     // this.totalPage = res.data.totalPage;
    //                     this.dataListLoading = false;
    //             }, err => {
    //                 this.$message.error(err);
    //             });
    //         },
    //         add() {
    //             if(this.$refs['addform']){
    //                 this.$refs['addform'].resetFields();
    //             }
    //             this.addVisible = true;
    //             // this.saveStatus = false;
    //             this.form = {
    //                 cycleName: '',
    //                 yearlyAdd: '',
    //                 productId3Add: '',
    //                 areaIdAdd: '',
    //                 beginDate: '',
    //                 endDate: '',
    //                 sleepWeek: [''],
    //                 dateTests:''
    //             }
    //         },
    //         checkData(index, val, type){
    //             let row = JSON.parse(JSON.stringify(val));
    //             let _this = this;
    //             this.$axios.get(baseUrl+'/ft/ftteaching/checkCycle.do?id='+row.id)
    //                     .then(res => {
    //                         if(res.data.code === 0){
    //                             if(type === 1){
    //                                 _this.handleEdit(index,row);
    //                             }else{
    //                                 _this.handleDelete(index,row);
    //                             }
    //                         }else{
    //                             this.$message.error(res.data.msg);
    //                             return;
    //                         }
    //                 }, err => {
    //                     this.$message.error(err);
    //                 });
    //         },
    //         handleEdit(index, val) {
    //             let row = {};
    //             row = Object.assign({}, val);
    //             this.form = {
    //                 cycleName: row.name,
    //                 yearlyAdd: row.yearly2+'',
    //                 productId3Add: row.productId3,
    //                 areaIdAdd: row.areaId+'',
    //                 dateTests:row.dateTests,
    //                 id:row.id
    //             }
    //             if(row.beginDate){
    //                 this.$set(this.form, 'beginDate', new Date(row.beginDate));
    //             }
    //             if(row.endDate){
    //                 this.$set(this.form, 'endDate', new Date(row.endDate));
    //             }
    //             this.items =[];
    //             /* if(row.sleepWeeks!==null && row.sleepWeeks!='' && row.sleepWeeks!=undefined){
    //                    var arr =  row.dateTests.split(',');
    //                    if(arr!=null && arr.length>0){
    //                        for(var k=0;k<arr.length;k++){
    //                            if(k==0){
    //                                 this.form.sleepWeek = arr[k];
    //                            } else{
    //                                var num = k-1;
    //                                var obj = {};
    //                                obj[num] = arr[k];
    //                             this.items.push(obj);
    //                            }
    //                        }
    //                    }
    //             } */
    //             if(row.sleepWeeks && row.sleepWeeks.length>0){
    //                 this.$set(this.form,'sleepWeek',row.sleepWeeks); 
    //             }else{
    //                 this.$set(this.form,'sleepWeek',['']);
    //             }
    //             if(this.$refs['form']){
    //                 this.$refs['form'].resetFields();
    //             }
    //             this.editVisible = true;
               
    //         },
    //         handleDelete(index, row) {
    //             this.cycleId= row.id;
    //             this.delVisible = true;
    //         },
    //         handleLook(index, row){
                
    //             this.cycleId = row.id ;
    //             this.lookVisible = true;
    //             //  this.addVisible = true;
    //             this.$axios.get(baseUrl+'/ft/ftteaching/showQRZSchoolCourseCycleCalender.do?schoolCourseCycleId='+this.cycleId)
    //                     .then(res => {
    //                         //获取菜单列表
    //                         this.calendarData = res.data.data; 
    //                 }, err => {
    //                     this.$message.error(err);
    //                 });

    //         },
    //         resetForm(formName, isShow){
    //             if(this.$refs[formName]){
    //                 this.$refs[formName].resetFields();
    //             }
    //             this[isShow] = false;
    //         },
    //         //新增保存操作
    //         dialogAddSave(){
    //             let _this = this;
    //             var restWeek = '';
    //             let val ='';
    //             let arr =[];
    //             /*  if(this.form.sleepWeek!=null && this.form.sleepWeek!='' && this.form.sleepWeek!=undefined){
    //                 restWeek += (dateToString2(this.form.sleepWeek));
    //             } */
    //             if(this.form.sleepWeek && this.form.sleepWeek.length>0){
    //                 this.form.sleepWeek.forEach(item=>{
    //                     if(item){
    //                         val =formatDate(new Date(item),'yyyy-MM-dd');
    //                         arr.push(val);
    //                     }
                        
    //                 })
    //                 restWeek = arr.join(',');
    //             }
    //             /*  for(var i=0;i<this.items.length;i++){
    //                 if(this.items[i][i]!=null){
    //                     restWeek += "," + dateToString2(this.items[i][i]);
    //                 }
    //             }   */        
    //             var beginDateForm = dateToString2(this.form.beginDate);
    //             var endDateForm = dateToString2(this.form.endDate);
    //             this.form.cycleName = (!isNaN(Number(this.form.cycleName)) || this.form.cycleName) ? this.form.cycleName: '';
    //             this.form.yearlyAdd = (!isNaN(Number(this.form.yearlyAdd)) || this.form.yearlyAdd) ? this.form.yearlyAdd: '';
    //             this.form.areaIdAdd = (!isNaN(Number(this.form.areaIdAdd)) || this.form.areaIdAdd) ? this.form.areaIdAdd: '';
    //             this.form.productId3Add = (!isNaN(Number(this.form.productId3Add)) || this.form.productId3Add) ? this.form.productId3Add: '';

    //             var contition = '?cycleName='+this.form.cycleName+'&yearlyAdd='+this.form.yearlyAdd+
    //                 '&areaIdAdd='+this.form.areaIdAdd+'&productId3Add='+this.form.productId3Add
    //                 +'&beginDate='+beginDateForm+'&endDate='+endDateForm
    //                 +'&sleepWeek='+restWeek+'&dateTests='+restWeek;                
    //             this.saveData('get', '/ft/ftteaching/saveQRZSchoolCourseCycle.do'+contition).then(res => {
    //                     //获取菜单列表
    //                     if(res.data.code == 0){
    //                         _this.$message.success('新增成功')
    //                         _this.addVisible = false;
    //                         _this.getTableData();
    //                     }else{
    //                         _this.$message.error(res.data.msg)
    //                     }
    //             }, err => {                 
    //                 this.$message.error(err);
    //             });
    //         },
    //         //新增
    //         saveAdd() {
    //            this.$refs['addform'].validate((valid) => {
    //                 if(valid){
    //                     this.firstSave();
    //                 }else{
    //                     this.$message.error('请输入必填项!');
    //                     return false;
    //                 }
    //            })
    //         },
    //         // 保存编辑
    //         saveEdit() {
    //             this.$refs['form'].validate((valid) => {
    //                 if(valid){
    //                     let _this = this;
    //                     var restWeek = '';
    //                     let val = '';
    //                     let arr =[];
    //                     if(this.form.sleepWeek && this.form.sleepWeek.length>0){
    //                         this.form.sleepWeek.forEach(item=>{
    //                             if(item){
    //                                 val = formatDate(new Date(item),'yyyy-MM-dd');
    //                                 arr.push(val);
    //                             }
                               
    //                         })
    //                         restWeek = arr.join(',');
    //                     }
    //                     this.form.cycleName = (!isNaN(Number(this.form.cycleName)) || this.form.cycleName) ? this.form.cycleName: '';
    //                     this.form.yearlyAdd = (!isNaN(Number(this.form.yearlyAdd)) || this.form.yearlyAdd) ? this.form.yearlyAdd: '';
    //                     this.form.areaIdAdd = (!isNaN(Number(this.form.areaIdAdd)) || this.form.areaIdAdd) ? this.form.areaIdAdd: '';
    //                     this.form.productId3Add = (!isNaN(Number(this.form.productId3Add)) || this.form.productId3Add) ? this.form.productId3Add: '';
    //                     // this.saveStatus = true;
    //                     var contition = '?eName='+this.form.cycleName+'&eYearly='+this.form.yearlyAdd+
    //                                 '&eAreaId='+this.form.areaIdAdd+'&ethreeProductId='+this.form.productId3Add
    //                                 +'&eBeginDate='+dateToString2(this.form.beginDate)+'&eEndDate='+dateToString2(this.form.endDate)
    //                                 +'&eid='+this.form.id+'&sleepWeek='+restWeek+ '&enewdateTests=' + restWeek;
    //                    /*  if(this.form.sleepWeek != null && this.form.sleepWeek != undefined && this.form.sleepWeek !== ''){
    //                         contition += '&sleepWeek='+this.form.sleepWeek;
    //                     } */

    //                     this.$axios.get(baseUrl+'/ft/ftteaching/saveEditQRZSchoolCourseCycle.do'+contition
    //                         )
    //                         .then(res => {
    //                             //获取菜单列表
    //                             _this.addVisible = false;
    //                             if(res.data.code == 0){
    //                                 _this.editVisible = false;
    //                                 _this.$message.success('修改成功');
    //                                 _this.getTableData();
    //                         }
    //                     }, err => {
    //                         // this.saveStatus =false;
    //                         this.$message.error(err);
    //                     });
    //                 }else{
    //                     this.$message.error('请输入必填项!');
    //                     return false;
    //                 }
    //             })
                
    //         },
    //         // 确定删除
    //         deleteRow(){
                
    //             this.$axios.get(baseUrl+'/ft/ftteaching/deleteQRZCourseCycleById.do'
    //                 +'?id='+this.cycleId)
    //                 .then(res => {
    //                     //获取菜单列表
    //                     if(res.data.code==1){
    //                         this.$message.success('删除成功');
    //                         this.delVisible = false;
    //                         this.getTableData();
    //                     }
    //             }, err => {
    //                 this.$message.error(err);
    //             });

    //         },
    //         submitForm(formInline) {
    //             this.dataListLoading = true;
    //             this.pageIndex = 1
    //             this.getTableData();
    //         },
    //         plusData(){
    //             // var num = this.text++;
    //             // var  date = this.dateBasic;
    //             this.form.sleepWeek.push('')
    //         },
    //         removeData(index){
    //             this.form.sleepWeek.splice(index,1)
    //         }
    //     }
    // }

</script>

<style scoped>
    .handle-box {
        margin-bottom: 20px;
    }

    .handle-select {
        width: 120px;
    }

    .handle-input {
        width: 300px;
        display: inline-block;
    }
    .del-dialog-cnt{
        font-size: 16px;
        text-align: center
    }
    .table{
        width: 100%;
        font-size: 14px;
    }
    .red{
        color: #ff0000;
    }
    .mr10{
        margin-right: 10px;
    }
    .searchBox{
        background-color: #fff;
        width: 98%;
        border: #e2e2e2 solid 1px;
        padding-top: 15px;
        padding-left: 2%; 
        margin-bottom: 10px;
    }
    .searchBox div div{
        margin-right: 20px;
    }
    .searchbt{
        text-align: center;
        /* margin-bottom: 10px; */
        margin-left: 10px;
    }
    .sjtb{
        width: 100%;
        background-color: #ECF5FF;
        line-height: 30px;
        text-align: center;
        font-size: 14px;
        color: #333;
        margin-bottom: 5px;
    }
    .sjtb-num{
        color: #ff0000;
        font-size: 16px;
        border-bottom: 2px solid #ff0000;
        font-weight: 600;
    }
    .sjtb-again{
        color: #409EFF;
        cursor: pointer;
    }
    .el-add{
        margin-left: 10px;
        font-size: 24px;
        padding: 5px 5px;
    }
    .el-remove{
        margin-left: 10px;
        font-size: 24px;
        padding: 5px 5px;
        color: #ff0000;
    }
    .el-dialog-div{
        height: 380px;
        overflow: auto;
    }
    .dialog-table{
        height: 340px;
        overflow: auto;
    }
    .zl-dialog .el-col-13{
        width: 80%;
    }
    .zl-dialog .el-select.el-select--small, 
    .zl-dialog .covered .el-input--small,
    .zl-dialog .small.covered .el-input__inner{
        width: 80% !important;
    }

</style>
